
# 4. 打印1~100所有偶数的和 减去 所有奇数的和 的值
os,js = 0,0
for x in range(1,101):
    if x % 2 == 0:
        os += x
    else:
        js += x
# print(os-js)

# 列表推导式
num1 = sum([x for x in range(1,101,2)])
num2 = sum([x for x in range(2,101,2)])
# print(num2-num1)


# 11. 输出 9*9 乘法口诀表。
for x in range(1,10):
    for y in range(1,x+1):
        print("{y} * {x} = {z}".format(y=y,x=x,z=x*y),end=' ')
    print()


# for x in ["{y} * {x} = {z}".format(y=y,x=x,z=x*y) for x in range(1,10) for y in range(1,x+1)]:
#     print(x)